package edu.zut.oop;

public class StudentOperation {

    /**
     * 提供一个操作Student对象的方法，这个方法能对具体Student对象的age进行修改
     * 对象作为参数，经常使用，和数组作为参数本质是一样的，都属于引用传递
     */
    public void setStuAge(Student student, int num) {
        int age = student.age;
        age = age + num;
        student.age = age;
    }

    public static void main(String[] args) {
        StudentOperation operation = new StudentOperation();
        Student student = new Student();
        student.name = "张三";
        student.num = "2021001";
        student.age = 20;
        operation.setStuAge(student,2);
        student.introduce();
    }
}
